package com.wwdablu.soumya.lottiebottomnavsample.fraction;

import com.wwdablu.soumya.lottiebottomnavsample.ResourceTable;
import com.wwdablu.soumya.lottiebottomnavsample.base.BaseFraction;
import ohos.agp.components.Button;

/**
 * MailFraction
 *
 * @since 2021-06-11
 */
public class MailFraction extends BaseFraction {
    private Button mBtnAnimate;
    /**
     * mClickHandler
     */
    private ClickHandler mClickHandler;

    /**
     * getUiContent
     *
     * @return int
     */
    @Override
    public int getUiContent() {
        return ResourceTable.Layout_fraction_mail;
    }

    /**
     * initComponent
     */
    @Override
    public void initComponent() {
        mBtnAnimate = (Button) mComponent.findComponentById(ResourceTable.Id_btn_animate);
        mBtnAnimate.setClickedListener(view -> {
            if (mClickHandler != null) {
                mClickHandler.onChangeMenuIcon();
            }
        });
    }

    /**
     * setClickHandler
     *
     * @param clickHandler
     */
    public void setClickHandler(ClickHandler clickHandler) {
        mClickHandler = clickHandler;
    }

    /**
     * ClickHandler
     *
     * @since 2021-06-11
     */
    public interface ClickHandler {
        /**
         * onChangeMenuIcon
         */
        void onChangeMenuIcon();
    }
}
